package com.superhelper.app.domain;

import java.util.Date;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

@JsonInclude(Include.NON_NULL)
public class Admin {
    private Long id;
    private String username;
    @JsonIgnore
    private String email;
    @JsonIgnore
    private String pwd;
    @JsonIgnore
    private Date createAt;
    @JsonIgnore
    private Date updateAt;
    @JsonIgnore
    private Date loginAt;
    @JsonIgnore
    private Integer roleCode;// 角色代码:0普通管理员,1超级管理员，2超级管理员
    @JsonIgnore
    private Integer status;// 用户状态:0正常,1禁止
    @JsonIgnore
    private String roleIds;
    @JsonIgnore
    private Integer createId;
    private String imid;
    private String plfFrom;
    private String packageName;
    private InvitationCode invitCode;
    private Date expireAt;
    private boolean tips;

    public Integer getStatus() {
	return status;
    }

    public void setStatus(Integer status) {
	this.status = status;
    }

    public Integer getRoleCode() {
	return roleCode;
    }

    public void setRoleCode(Integer roleCode) {
	this.roleCode = roleCode;
    }

    public String getUsername() {
	return username;
    }

    public void setUsername(String username) {
	this.username = username;
    }

    public String getPwd() {
	return pwd;
    }

    public void setPwd(String pwd) {
	this.pwd = pwd;
    }

    public Date getCreateAt() {
	return createAt;
    }

    public void setCreateAt(Date createAt) {
	this.createAt = createAt;
    }

    public Date getUpdateAt() {
	return updateAt;
    }

    public void setUpdateAt(Date updateAt) {
	this.updateAt = updateAt;
    }

    public String getEmail() {
	return email;
    }

    public void setEmail(String email) {
	this.email = email;
    }

    public String getRoleIds() {
	return roleIds;
    }

    public void setRoleIds(String roleIds) {
	this.roleIds = roleIds;
    }

    public Integer getCreateId() {
	return createId;
    }

    public void setCreateId(Integer createId) {
	this.createId = createId;
    }

    public Date getLoginAt() {
	return loginAt;
    }

    public void setLoginAt(Date loginAt) {
	this.loginAt = loginAt;
    }

    public Long getId() {
	return id;
    }

    public void setId(Long id) {
	this.id = id;
    }

    public String getImid() {
	return imid;
    }

    public void setImid(String imid) {
	this.imid = imid;
    }

    public String getPlfFrom() {
	return plfFrom;
    }

    public void setPlfFrom(String plfFrom) {
	this.plfFrom = plfFrom;
    }

    public InvitationCode getInvitCode() {
	return invitCode;
    }

    public void setInvitCode(InvitationCode invitCode) {
	this.invitCode = invitCode;
    }

    public String getPackageName() {
	return packageName;
    }

    public void setPackageName(String packageName) {
	this.packageName = packageName;
    }

    public Date getExpireAt() {
	return expireAt;
    }

    public void setExpireAt(Date expireAt) {
	this.expireAt = expireAt;
    }

    public boolean isTips() {
	Long ctime = System.currentTimeMillis();
	long dayTime = 3 * 24 * 3600 * 1000; // 提前三天提示
	if (this.getExpireAt() != null && ctime - this.getExpireAt().getTime() > dayTime) {
	    tips = true;
	}
	return tips;
    }

    public void setTips(boolean tips) {
	this.tips = tips;
    }

}
